package com.baseproject.widget;

import android.view.View;
import android.widget.PopupWindow;

/**
 * Created by hp on 2017/7/18.
 */

public class MyPopupWindow extends PopupWindow {

    public MyPopupWindow(View contentView) {
        super(contentView);
    }

    /**
     * 处理7.0系统上点击外部区域，自动隐藏popupwindow的问题
     */
    private boolean interceptToDisableAutoDismissOutside = false;

    public boolean isInterceptToDisableAutoDismissOutside() {
        return interceptToDisableAutoDismissOutside;
    }

    public void setInterceptToDisableAutoDismissOutside(boolean interceptToDisableAutoDismissOutside) {
        this.interceptToDisableAutoDismissOutside = interceptToDisableAutoDismissOutside;
    }

    /**
     * 处理7.0系统上点击外部区域，自动隐藏popupwindow的问题
     */
    @Override
    public boolean isShowing() {
        if (interceptToDisableAutoDismissOutside) {
            return false;
        } else {
            return super.isShowing();
        }
    }
}
